#!/usr/bin/env bash
ARGS=($@)
for i in ${!ARGS[@]}; do
    if [ -e "${ARGS[i]}" ]; then
        ARGS[$i]=$(realpath -e "${ARGS[$i]}")
    fi  
done
set -- "${ARGS[@]}"
cd "${0%/*}"
ParamILS_MEMORY_INPUT=$ParamILS_MEMORY
ParamILSMEM=1024
test "$ParamILS_MEMORY_INPUT" -ge 1 2>&- && ParamILSMEM=$ParamILS_MEMORY_INPUT
EXEC=ca.ubc.cs.beta.paramils.executors.ParamILSExecutor
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ ! -d "$DIR/lib" ]; then
  DIR="$(dirname "$DIR")"
fi

exec java -XX:-UsePerfData -Djava.io.tmpdir="$TMP" -Xmx"$ParamILSMEM"m -cp "./lib/*" ca.ubc.cs.beta.aeatk.ant.execscript.Launcher $EXEC "$@"
